<template>
  <el-container>
    <el-aside width="200px">
      <img class="logo-white" src="../assets/img/logo-white.png" />
      <Nav />
    </el-aside>
    <el-container>
      <el-header>
          <div class="login-info">
              <el-dropdown>
                <span class="el-dropdown-link">
                    <img src="../assets/1.jpg"> 大艳儿
                </span>
                <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>
                        <i class="el-icon-user-solid"></i>
                        个人中心
                    </el-dropdown-item>
                    <el-dropdown-item>
                        <i class="el-icon-s-tools"></i>
                        系统设置
                    </el-dropdown-item>
                    <el-dropdown-item >
                        <i class="el-icon-error"></i>
                        <span @click="logout">安全退出</span>
                    </el-dropdown-item>
                </el-dropdown-menu>
                </el-dropdown>
              <!-- <img src="../assets/logo.png">
                管理员 -->
          </div>    
      </el-header>
      <el-main>
          <router-view />
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
import Nav from '../components/Nav.vue'
export default {
  components:{
    Nav
  },
  methods: {
    logout(){
      //通知退出成功
      this.$message({
        message: "再见",
        type: 'success'
      })
      //清除localStorage 的loginData
      localStorage.removeItem("loginData")
      //跳转到登录页面
      this.$router.replace("/login")
    }
  }
};
</script>

<style>
.el-header {
  background-color: #ffffff;
  color: #333;
  text-align: center;
  line-height: 60px;
}

.login-info{
    width: 200px;
    float: right;
    line-height: 60px;
}
.login-info img{
    width: 30px;
    height: 30px;
    border-radius: 50%;
    vertical-align: middle;
}

.el-aside {
  background-color: #ff5a3b;
  color: #fff;
  text-align: center;
  height: 100vh;
}

.logo-white {
  width: 160px;
  margin-top: 9px;
}
.el-menu-item i{
    color: white !important;
}
.el-main {
  background-color: #e9eef3;
  color: #333;
}
.el-menu-vertical-demo{
    text-align: left;
}
</style>